import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.buffer.Unpooled;
import utils.ByteUtil;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class Test {
    public static void main(String[] args) throws IOException {

//        String path = "D:\\GitintellijProject\\xny\\gb32960Parse\\testData.txt";
       // byte[] buf = Util.readTxt(path);
        String test="232302FE4C47415833503133584D3630303031393101024A150C03103330010103010000000014E815D936C16101000AE3000002010101464E204E204715F42710050006B9C51801AEC9FC0601B50D0301030D000128450120400700000000000000000008010115D936C101500001C80D010D010D000D000D010D010D010D010D000D020D010D010D020D010D010D010D010D010D010D010D000D010D010D010D010D010D010D010D000D010D010D010D010D010D010D020D010D020D020D020D020D020D010D010D010D010D010D010D020D010D010D020D020D020D020D020D010D010D010D010D010D010D010D010D010D020D010D020D020D020D010D010D000D000D010D010D010D000D010D010D010D010D010D020D000D010D010D000D010D010D010D010D010D010D020D020D020D020D010D000D010D010D010D000D010D010D010D010D020D010D010D020D010D000D000D010D010D000D010D010D000D010D010D020D020D010D010D010D010D010D010D010D010D010D010D020D020D020D020D020D010D010D010D010D010D010D010D000D010D020D010D010D010D020D010D010D010D010D010D010D010D010D010D020D020D020D020D020D000D010D000D010D010D010D010D010D010D020D020D020D030D020D010D010D010D010D010D010D010D010D010D020D020D020D020D020D010D010D010D0109010100384343444343434344444443444344414343414142424343434243424241444240414242434444424542434243424141424143444342444243820005444653593383001A00010009000444465359332D322E30302D4534430000000000009F";
//
//        String VIN = "100000VIN00000000";
//        ByteBuf byteBuf = Unpooled.copiedBuffer(test.getBytes());
//
//
//        Header header=new Header().decode(byteBuf);
//        System.out.println(header.getVin());
//        System.out.println(header.getLength());
//        System.out.println(header.getEncryptionType());
//
//        Massage massage = new Massage().decode(byteBuf);
//        System.out.println(massage.getHeader().getCommandType());
//        System.out.println(massage.getDataBody().getRealTimeData().getExtremeData().getBatteryMaxVoltage());
        String vin="15";//150C03103330//4C47415833503133584D36303030313931
        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
        buffer.writeBytes(ByteUtil.hexStringToBytes(vin));
        System.out.println(buffer.readSlice(2).toString(StandardCharsets.UTF_8));
    }
}
